

import sys
try:
	import pygtk
	pygtk.require("2.0")
except:
	print "error: 1"
	pass
try:
	import gtk, gobject, cairo
	import gtk.glade
except:
	print "error: 2"
	sys.exit(1)


class Gui:
	
	def __init__(self):
		#gtk.gdk.threads_init()
	
		# Set the Glade file
		self.gladefile = "gui.glade"  
		self.wTree = gtk.glade.XML(self.gladefile)
		
		# Connect the destroy event
		self.window = self.wTree.get_widget("main")
		if (self.window):
			self.window.connect("destroy", gtk.main_quit)
		
		# TEMP!!!		
		#from PIL import Image
		#from cadobject import CadObject
		#image = Image.open("solidruler.png")
		#cad_object = CadObject(image=image)
		#self.cad_widget.set_cad_object(cad_object)
		
		w = self.wTree.get_widget("main")
		w.show()
		
		# Start gtk
		gtk.main()

gui = Gui()
